/**
 * 材料
 */
export default  class MaterialEntity {
    constructor(id,name, quantity, unit, supplier) {
        this.id=id;
        this.name = name;
        this.quantity = quantity;
        this.unit = unit;
        this.supplier = supplier;
        this.items=new Array();//属性
    }

    updateQuantity(newQuantity) {
        this.quantity = newQuantity;
        console.log(`The quantity of ${this.name} is now ${newQuantity} ${this.unit}.`);
    }

    changeSupplier(newSupplier) {
        this.supplier = newSupplier;
        console.log(`The supplier of ${this.name} is now ${newSupplier}.`);
    }
}

// 示例用法
const material1 = new Material(1,'Steel', 100, 'kg', 'Supplier A');
console.log(material1.name);  // 输出: Steel
console.log(material1.quantity);  // 输出: 100
console.log(material1.unit);  // 输出: kg
console.log(material1.supplier);  // 输出: Supplier A
material1.updateQuantity(150);  // 输出: The quantity of Steel is now 150 kg.
material1.changeSupplier('Supplier B');  // 输出: The supplier of Steel is now Supplier B.
